import Vue from 'vue'
import Router from 'vue-router'
import Login from '../components/Login/login.vue'
import Index from "../components/Product/index.vue"

import Home from "../components/Product/components/home.vue"
import Comm from "../components/Product/components/commodity.vue"
import Cate from '../components/Product/components/category.vue'
import Order from '../components/Product/components/order.vue'
import Users from '../components/Product/components/users.vue'
import Addcom from "../components/commodity/addComm.vue"
import AddCate from "../components/cate/addCate.vue"
import Commdetail from "../components/commodity/commdetail.vue"
import Updata from "../components/commodity/updata.vue"
import Orderdetail from "../components/order/orderdetail.vue"
import CateItem from "../components/cate/cateitem.vue"
import Echarts from "../components/comm/echarts.vue"
import Bmap from "../components/comm/Bmap.vue"
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: "/",
      redirect: '/product/index'
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/product/index',
      name: 'index',
      component: Index,
      meta:{
        title:"首页",
        requireAuth:true
      },
      children: [
        {
          path: '/',
          name: 'home',
          component: Home,
          meta:{
            title:"首页",
            requireAuth:true
          },
        },
        {
          path: '/product/index/comm',
          name: 'comm',
          component: Comm,
          meta:{
            title:"商品管理",
            requireAuth:true
          },
        },
        {
          path: '/product/index/cate',
          name: 'cate',
          component: Cate,
          meta:{
            title:"品类管理",
            requireAuth:true
          },
        },
        {
          path: '/product/index/order',
          name: 'order',
          component: Order,
          meta:{
            title:"订单管理",
            requireAuth:true
          },
        },
        {
          path: '/product/index/users',
          name: 'users',
          component: Users,
          meta:{
            title:"用户管理",
            requireAuth:true
          },
        },
        {
          path: '/product/index/addcom',
          name: 'addcom',
          component: Addcom,
          meta:{
            title:"添加商品",
            requireAuth:true
          },
        },
        {
          path: '/product/index/addcate',
          name: 'addcate',
          component: AddCate,
          meta:{
            title:"添加品类",
            requireAuth:true
          },
        },
        {
          path: '/product/index/detail',
          name: 'detail',
          component: Commdetail,
          meta:{
            title:"商品详情",
            requireAuth:true
          },
        },
        {
          path: '/product/index/updata',
          name: 'updata',
          component: Updata,
          meta:{
            title:"商品编辑",
            requireAuth:true
          },
        },
        {
          path: '/product/index/orderdetail',
          name: 'orderdetail',
          component: Orderdetail,
          meta:{
            title:"订单详情",
            requireAuth:true
          },
        },
        {
          path: '/product/index/cateItem',
          name: 'cateItem',
          component: CateItem,
          meta:{
            title:"品类管理",
            requireAuth:true
          },
        },
        {
          path: '/product/index/echarts',
          name: 'echarts',
          component: Echarts,
          meta:{
            title:"图表",
            requireAuth:true
          },
        },
        {
          path: '/product/index/bmap',
          name: 'bmap',
          component: Bmap,
          meta:{
            title:"百度地图",
            requireAuth:true
          },
        }
      ]
    }
  ]
})
